const { Model, DataTypes } = require("sequelize");
const sequelize = require("../database");

class Jmx extends Model { }

Jmx.init({
    id: {
        type: DataTypes.INTEGER,
        autoIncrement: true,
        primaryKey: true
    },
    product_id: {
        type: DataTypes.INTEGER,
        allowNull: true
    },
    uuid: {
        type: DataTypes.CHAR(36),
        allowNull: false
    },
    jmx_name: {
        type: DataTypes.STRING(255),
        allowNull: false
    },
    jmx_path: {
        type: DataTypes.STRING(255),
        allowNull: false
    },
    created_at: {
        type: DataTypes.DATE,
        defaultValue: DataTypes.NOW
    },
    updated_at: {
        type: DataTypes.DATE,
        defaultValue: DataTypes.NOW,
        onUpdate: "CURRENT_TIMESTAMP"
    }
}, {
    sequelize,
    modelName: "Jmx",
    tableName: "jmx",
    timestamps: false, 
    charset: "utf8mb4",
    collate: "utf8mb4_0900_ai_ci"
});

module.exports = Jmx;    